<template>
    <detail-page>
        <div class="title">
            {{cinemaName}}
            <span @click="$router.go(-1)">更换影城</span>
        </div>
        <div class="time-list">
            <div class="time-btn" v-for="(time,index) in times" :key="index" :class="{disabled:!!time.isFull}" @click="timeSelect(time)">
                {{time.time}}
            </div>
        </div>
    </detail-page>
</template>

<script>
import DetailPage from '@/components/DetailPage'
export default {
  components: {DetailPage},
  data () {
    return {
      times: [],
      cinemaId: '',
      cinemaName: ''
    }
  },
  methods: {
    timeSelect (time) {
      if (!time.isFull) {
        this.$router.push({path: 'submit_info', query: {hallId: time.id, channel: this.channel}})
      }
    }
  },
  async created () {
    this.cinemaId = this.$route.query.cinemaId
    this.cinemaName = this.$route.query.cinemaName
    this.channel = this.$route.query.channel
    this.times = await this.$request.post('/api_ygc/halls', {cinemaId: this.cinemaId, channel: this.channel})
  }
}
</script>

<style scoped lang="scss">
.title{
    color:#595757;
    font-size: 30px;
    text-align: center;
    position: absolute;
    top:338px;
    width: 100%;
    span{
        color:#159eec;
        font-size: 24px;
    }
}
.time-list{
    position: absolute;
    top:400px;
    left:0px;
    width:100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow-y: auto;
    max-height: 50vh;
    -webkit-overflow-scrolling: touch;
    .time-btn{
        width: 540px;
        height: 122px;
        background-image: url('~@/assets/8.png');
        background-size: 100% 100%;
        background-repeat: no-repeat;
        font-size: 30px;
        color:#fff;
        line-height: 120px;
        text-align: center;
        &+.time-btn{
            margin-top:-14px;
        }
        &.disabled{
            background-image: url('~@/assets/9.png');
        }
    }
}
</style>
